#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int findContentChildren(vector<int>& g, vector<int>& s) {
        sort(g.begin(), g.end());
        sort(s.begin(), s.end());
        int left = 0;
        for (int i = 0; i < s.size(); i++)
            if (left >= g.size()) break;
            else if (s[i] >= g[left]) left++;
        return left;
    }
};